package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Tuiyao {
    private int tyId;
    private String tyPeople;
    private String tyShuliang;
    private String tyDate;
    private String attribute76;
    private Collection<TuiyaoDetails> tuiyaoDetailsByTyId;

    @Id
    @Column(name = "ty_id", nullable = false)
    public int getTyId() {
        return tyId;
    }

    public void setTyId(int tyId) {
        this.tyId = tyId;
    }

    @Basic
    @Column(name = "ty_people", nullable = true, length = 30)
    public String getTyPeople() {
        return tyPeople;
    }

    public void setTyPeople(String tyPeople) {
        this.tyPeople = tyPeople;
    }

    @Basic
    @Column(name = "ty_shuliang", nullable = true, length = 10)
    public String getTyShuliang() {
        return tyShuliang;
    }

    public void setTyShuliang(String tyShuliang) {
        this.tyShuliang = tyShuliang;
    }

    @Basic
    @Column(name = "ty_date", nullable = true, length = 10)
    public String getTyDate() {
        return tyDate;
    }

    public void setTyDate(String tyDate) {
        this.tyDate = tyDate;
    }

    @Basic
    @Column(name = "attribute_76", nullable = true, length = 10)
    public String getAttribute76() {
        return attribute76;
    }

    public void setAttribute76(String attribute76) {
        this.attribute76 = attribute76;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Tuiyao tuiyao = (Tuiyao) o;
        return tyId == tuiyao.tyId &&
                Objects.equals(tyPeople, tuiyao.tyPeople) &&
                Objects.equals(tyShuliang, tuiyao.tyShuliang) &&
                Objects.equals(tyDate, tuiyao.tyDate) &&
                Objects.equals(attribute76, tuiyao.attribute76);
    }

    @Override
    public int hashCode() {
        return Objects.hash(tyId, tyPeople, tyShuliang, tyDate, attribute76);
    }

    @OneToMany(mappedBy = "tuiyaoByTyId")
    public Collection<TuiyaoDetails> getTuiyaoDetailsByTyId() {
        return tuiyaoDetailsByTyId;
    }

    public void setTuiyaoDetailsByTyId(Collection<TuiyaoDetails> tuiyaoDetailsByTyId) {
        this.tuiyaoDetailsByTyId = tuiyaoDetailsByTyId;
    }
}
